package c.j.a.d.b.e;

import android.database.sqlite.SQLiteException;
import android.os.Handler;
import android.text.TextUtils;
import android.util.SparseArray;
import c.j.a.d.b.b.g;
import c.j.a.d.b.d.b0;
import c.j.a.d.b.d.l;
import c.j.a.d.b.d.q;
import c.j.a.d.b.j.a0;
import com.ss.android.socialbase.downloader.g.c;
import java.util.Objects;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.atomic.AtomicLong;

/* compiled from: DownloadStatusHandler */
public class h {
    public static final String q = "h";
    public final boolean a;
    public c b;
    public final n c;
    public final Handler d;
    public c.j.a.d.b.h.c e;
    public SparseArray<c.j.a.d.b.d.b> f;
    public SparseArray<c.j.a.d.b.d.b> g;
    public SparseArray<c.j.a.d.b.d.b> h;
    public boolean i = false;
    public volatile long j = 0;
    public final AtomicLong k = new AtomicLong();
    public boolean l = false;
    public int m;
    public long n;
    public b0 o;
    public q p;

    /* compiled from: DownloadStatusHandler */
    public class a implements l {
        public void a(com.ss.android.socialbase.downloader.e.a aVar) {
            String str = h.q;
            StringBuilder g = c.b.a.a.a.g("saveFileAsTargetName onFailed : ");
            g.append(aVar != null ? aVar.b : "");
            c.j.a.d.b.g.a.d(str, g.toString());
            h.this.d(aVar);
        }

        public void a() {
            h.h(h.this);
        }
    }

    /* compiled from: DownloadStatusHandler */
    public class b implements l {
        public void a(com.ss.android.socialbase.downloader.e.a aVar) {
            String str = h.q;
            StringBuilder g = c.b.a.a.a.g("saveFileAsTargetName onFailed : ");
            g.append(aVar != null ? aVar.b : "");
            c.j.a.d.b.g.a.d(str, g.toString());
            h.this.d(aVar);
        }

        public void a() {
            h.h(h.this);
        }
    }

    public h(c.j.a.d.b.h.c cVar, Handler handler) {
        this.e = cVar;
        n();
        this.d = handler;
        this.c = b.x();
        c cVar2 = cVar.a;
        if (cVar2 != null) {
            this.a = c.j.a.d.b.l.a.d(cVar2.g0()).k("fix_start_with_file_exist_update_error", false);
        } else {
            this.a = false;
        }
    }

    public static void h(h hVar) {
        Objects.requireNonNull(hVar);
        try {
            c.j.a.d.b.g.a.d(q, "saveFileAsTargetName onSuccess");
            hVar.o();
            hVar.b.W = false;
            hVar.b(-3, null, true);
            hVar.c.t(hVar.b.g0(), hVar.b.T);
            hVar.c.d(hVar.b.g0());
        } catch (com.ss.android.socialbase.downloader.e.a e) {
            hVar.d(e);
        } catch (Throwable th) {
            hVar.d(new com.ss.android.socialbase.downloader.e.a(1008, c.j.a.d.b.n.a.B(th, "onCompleted")));
        }
    }

    public void a() {
        if (!this.b.x()) {
            this.b.b0(1);
            ExecutorService q = b.q();
            if (q != null) {
                q.execute(new g(this));
            }
        }
    }

    /* JADX WARNING: Missing block: B:88:0x00e4, code skipped:
            if (r10.b.J() != false) goto L_0x00e6;
     */
    public final void b(int r11, com.ss.android.socialbase.downloader.e.a r12, boolean r13) {
        /*
        r10 = this;
        r0 = r10.b;
        r0 = r0.o0();
        r1 = 4;
        r2 = -3;
        if (r0 != r2) goto L_0x000d;
    L_0x000a:
        if (r11 != r1) goto L_0x000d;
    L_0x000c:
        return;
    L_0x000d:
        r10.n();
        r3 = -2;
        r4 = -4;
        r5 = -1;
        r6 = 0;
        r7 = 1;
        if (r11 == r1) goto L_0x0045;
    L_0x0017:
        if (r11 == r2) goto L_0x002c;
    L_0x0019:
        if (r11 == r5) goto L_0x002c;
    L_0x001b:
        if (r11 == r4) goto L_0x002c;
    L_0x001d:
        if (r11 == r3) goto L_0x002c;
    L_0x001f:
        r1 = 5;
        if (r11 == r1) goto L_0x002c;
    L_0x0022:
        r1 = 7;
        if (r11 == r1) goto L_0x002c;
    L_0x0025:
        r1 = 8;
        if (r11 != r1) goto L_0x002a;
    L_0x0029:
        goto L_0x002c;
    L_0x002a:
        r1 = 0;
        goto L_0x002d;
    L_0x002c:
        r1 = 1;
    L_0x002d:
        if (r1 == 0) goto L_0x0045;
    L_0x002f:
        r1 = r10.b;
        r1.f0(r6);
        if (r11 == r2) goto L_0x003d;
    L_0x0036:
        if (r11 == r5) goto L_0x003d;
    L_0x0038:
        if (r11 != r4) goto L_0x003b;
    L_0x003a:
        goto L_0x003d;
    L_0x003b:
        r1 = 0;
        goto L_0x003e;
    L_0x003d:
        r1 = 1;
    L_0x003e:
        if (r1 == 0) goto L_0x0045;
    L_0x0040:
        r1 = r10.b;
        r1.H();
    L_0x0045:
        r1 = r10.p;
        if (r1 == 0) goto L_0x005f;
    L_0x0049:
        r1 = r1.b();
        if (r1 == 0) goto L_0x005f;
    L_0x004f:
        r8 = r1.length;
        if (r8 <= 0) goto L_0x005f;
    L_0x0052:
        r8 = 0;
    L_0x0053:
        r9 = r1.length;
        if (r8 >= r9) goto L_0x005f;
    L_0x0056:
        r9 = r1[r8];
        if (r11 != r9) goto L_0x005c;
    L_0x005a:
        r1 = 1;
        goto L_0x0060;
    L_0x005c:
        r8 = r8 + 1;
        goto L_0x0053;
    L_0x005f:
        r1 = 0;
    L_0x0060:
        r8 = 2;
        if (r11 == r8) goto L_0x006e;
    L_0x0063:
        if (r11 == r2) goto L_0x006e;
    L_0x0065:
        if (r11 == r5) goto L_0x006e;
    L_0x0067:
        if (r11 == r4) goto L_0x006e;
    L_0x0069:
        if (r11 != r3) goto L_0x006c;
    L_0x006b:
        goto L_0x006e;
    L_0x006c:
        r3 = 0;
        goto L_0x006f;
    L_0x006e:
        r3 = 1;
    L_0x006f:
        if (r3 != 0) goto L_0x0073;
    L_0x0071:
        if (r1 == 0) goto L_0x0083;
    L_0x0073:
        r1 = r10.o;	 Catch:{ all -> 0x007c }
        if (r1 == 0) goto L_0x007c;
    L_0x0077:
        r3 = r10.b;	 Catch:{ all -> 0x007c }
        r1.a(r3, r12, r11);	 Catch:{ all -> 0x007c }
    L_0x007c:
        r1 = r10.p;
        r3 = r10.b;
        c.j.a.c.y.a.i.n(r1, r3, r12, r11);
    L_0x0083:
        r1 = 6;
        if (r11 != r1) goto L_0x008c;
    L_0x0086:
        r1 = r10.b;
        r1.b0(r8);
        goto L_0x009a;
    L_0x008c:
        r1 = -6;
        if (r11 != r1) goto L_0x0095;
    L_0x008f:
        r1 = r10.b;
        r1.b0(r2);
        goto L_0x009a;
    L_0x0095:
        r1 = r10.b;
        r1.b0(r11);
    L_0x009a:
        if (r0 == r2) goto L_0x009e;
    L_0x009c:
        if (r0 != r5) goto L_0x00be;
    L_0x009e:
        r0 = r10.b;
        r1 = r0.G;
        r2 = c.j.a.d.b.b.h.DELAY_RETRY_DOWNLOADING;
        if (r1 != r2) goto L_0x00aa;
    L_0x00a6:
        r1 = c.j.a.d.b.b.h.DELAY_RETRY_DOWNLOADED;
        r0.G = r1;
    L_0x00aa:
        r1 = r0.I;
        r2 = c.j.a.d.b.b.a.ASYNC_HANDLE_DOWNLOADING;
        if (r1 != r2) goto L_0x00b4;
    L_0x00b0:
        r1 = c.j.a.d.b.b.a.ASYNC_HANDLE_DOWNLOADED;
        r0.I = r1;
    L_0x00b4:
        r1 = r0.k0;
        r2 = c.j.a.d.b.b.b.BYTE_INVALID_RETRY_STATUS_DOWNLOADING;
        if (r1 != r2) goto L_0x00be;
    L_0x00ba:
        r1 = c.j.a.d.b.b.b.BYTE_INVALID_RETRY_STATUS_DOWNLOADED;
        r0.k0 = r1;
    L_0x00be:
        r0 = r10.g;
        r1 = r10.b;
        c.j.a.c.y.a.i.l(r11, r0, r7, r1, r12);
        if (r11 != r4) goto L_0x00c8;
    L_0x00c7:
        return;
    L_0x00c8:
        if (r13 == 0) goto L_0x00f8;
    L_0x00ca:
        r13 = r10.f;
        if (r13 == 0) goto L_0x00d4;
    L_0x00ce:
        r13 = r13.size();
        if (r13 > 0) goto L_0x00e6;
    L_0x00d4:
        r13 = r10.h;
        if (r13 == 0) goto L_0x00f8;
    L_0x00d8:
        r13 = r13.size();
        if (r13 <= 0) goto L_0x00f8;
    L_0x00de:
        r13 = r10.b;
        r13 = r13.J();
        if (r13 == 0) goto L_0x00f8;
    L_0x00e6:
        r13 = r10.d;
        if (r13 == 0) goto L_0x00f8;
    L_0x00ea:
        r0 = r10.b;
        r0 = r0.g0();
        r11 = r13.obtainMessage(r11, r0, r6, r12);
        r11.sendToTarget();
        goto L_0x0107;
    L_0x00f8:
        r12 = c.j.a.d.b.e.b.B();
        if (r12 == 0) goto L_0x0107;
    L_0x00fe:
        r13 = r10.b;
        r13 = r13.g0();
        r12.b(r13, r11);
    L_0x0107:
        return;
        */
        throw new UnsupportedOperationException("Method not decompiled: c.j.a.d.b.e.h.b(int, com.ss.android.socialbase.downloader.e.a, boolean):void");
    }

    public void c(long j, String str, String str2) {
        c cVar = this.b;
        cVar.T = j;
        cVar.E = str;
        if (!TextUtils.isEmpty(str2) && TextUtils.isEmpty(this.b.b)) {
            this.b.b = str2;
        }
        try {
            this.c.I(this.b.g0(), j, str, str2);
        } catch (Exception e) {
            e.printStackTrace();
        }
        b(3, null, true);
        c cVar2 = this.b;
        int i = cVar2.q;
        if (i <= 0) {
            i = 100;
        }
        j /= (long) (i + 1);
        if (j <= 0) {
            j = 1048576;
        }
        this.n = j;
        int i2 = cVar2.r;
        if (i2 < 1000) {
            i2 = 1000;
        }
        this.m = i2;
        this.i = true;
        a0.a().b(5, false);
    }

    /* JADX WARNING: Missing exception handler attribute for start block: B:12:0x0038 */
    /* JADX WARNING: Failed to process nested try/catch */
    public void d(com.ss.android.socialbase.downloader.e.a r6) {
        /*
        r5 = this;
        r0 = r5.b;
        r1 = 0;
        r0.V = r1;
        if (r6 == 0) goto L_0x0026;
    L_0x0007:
        r0 = r6.getCause();
        if (r0 == 0) goto L_0x0026;
    L_0x000d:
        r0 = r6.getCause();
        r0 = r0 instanceof android.database.sqlite.SQLiteFullException;
        if (r0 == 0) goto L_0x0026;
    L_0x0015:
        r0 = r5.c;	 Catch:{ SQLiteException -> 0x0021 }
        r2 = r5.b;	 Catch:{ SQLiteException -> 0x0021 }
        r2 = r2.g0();	 Catch:{ SQLiteException -> 0x0021 }
        r0.f(r2);	 Catch:{ SQLiteException -> 0x0021 }
        goto L_0x0048;
    L_0x0021:
        r0 = move-exception;
        r0.printStackTrace();
        goto L_0x0048;
    L_0x0026:
        r0 = r5.c;	 Catch:{ SQLiteException -> 0x0038 }
        r2 = r5.b;	 Catch:{ SQLiteException -> 0x0038 }
        r2 = r2.g0();	 Catch:{ SQLiteException -> 0x0038 }
        r3 = r5.b;	 Catch:{ SQLiteException -> 0x0038 }
        r3 = r3.I();	 Catch:{ SQLiteException -> 0x0038 }
        r0.O(r2, r3);	 Catch:{ SQLiteException -> 0x0038 }
        goto L_0x0048;
    L_0x0038:
        r0 = r5.c;	 Catch:{ SQLiteException -> 0x0044 }
        r2 = r5.b;	 Catch:{ SQLiteException -> 0x0044 }
        r2 = r2.g0();	 Catch:{ SQLiteException -> 0x0044 }
        r0.f(r2);	 Catch:{ SQLiteException -> 0x0044 }
        goto L_0x0048;
    L_0x0044:
        r0 = move-exception;
        r0.printStackTrace();
    L_0x0048:
        r0 = r5.b;
        r0 = r0.g0();
        r0 = c.j.a.d.b.l.a.d(r0);
        r2 = "download_failed_check_net";
        r0 = r0.b(r2, r1);
        r2 = 1;
        if (r0 != r2) goto L_0x0080;
    L_0x005b:
        r0 = c.j.a.d.b.n.a.X(r6);
        if (r0 == 0) goto L_0x0080;
    L_0x0061:
        r0 = c.j.a.d.b.e.b.a();
        if (r0 == 0) goto L_0x0080;
    L_0x0067:
        r0 = c.j.a.d.b.n.a.G(r0);
        if (r0 != 0) goto L_0x0080;
    L_0x006d:
        r0 = new com.ss.android.socialbase.downloader.e.a;
        r3 = r5.b;
        r3 = r3.g;
        if (r3 == 0) goto L_0x0078;
    L_0x0075:
        r3 = 1013; // 0x3f5 float:1.42E-42 double:5.005E-321;
        goto L_0x007a;
    L_0x0078:
        r3 = 1049; // 0x419 float:1.47E-42 double:5.183E-321;
    L_0x007a:
        r6 = r6.b;
        r0.m4677init(r3, r6);
        r6 = r0;
    L_0x0080:
        r0 = r5.b;
        r0.A0 = r6;
        r0 = r6 instanceof com.ss.android.socialbase.downloader.e.f;
        if (r0 == 0) goto L_0x008a;
    L_0x0088:
        r0 = -2;
        goto L_0x008b;
    L_0x008a:
        r0 = -1;
    L_0x008b:
        r5.b(r0, r6, r2);
        r6 = r5.b;
        r6 = r6.g0();
        r6 = c.j.a.d.b.l.a.d(r6);
        r0 = "retry_schedule";
        r6 = r6.b(r0, r1);
        if (r6 <= 0) goto L_0x00a9;
    L_0x00a0:
        r6 = c.j.a.d.b.j.a0.a();
        r0 = r5.b;
        r6.c(r0);
    L_0x00a9:
        return;
        */
        throw new UnsupportedOperationException("Method not decompiled: c.j.a.d.b.e.h.d(com.ss.android.socialbase.downloader.e.a):void");
    }

    public void e(com.ss.android.socialbase.downloader.e.a aVar, boolean z) {
        this.b.V = false;
        this.k.set(0);
        this.c.g(this.b.g0());
        b(z ? 7 : 5, aVar, true);
    }

    public void f(String str) throws com.ss.android.socialbase.downloader.e.a {
        String str2 = q;
        StringBuilder j = c.b.a.a.a.j("onCompleteForFileExist existTargetFileName is ", str, " but curName is ");
        j.append(this.b.b);
        c.j.a.d.b.g.a.d(str2, j.toString());
        if (this.a) {
            c.j.a.d.b.n.a.m(this.b, str);
            o();
            b(-3, null, true);
            this.c.a(this.b);
            return;
        }
        this.c.a(this.b);
        c.j.a.d.b.n.a.m(this.b, str);
        o();
        b(-3, null, true);
    }

    /* JADX WARNING: Missing block: B:12:0x0027, code skipped:
            if (r1 != c.j.a.d.b.b.a.ASYNC_HANDLE_RESTART) goto L_0x002d;
     */
    public void g() {
        /*
        r4 = this;
        r0 = r4.b;
        r0 = r0.x();
        if (r0 == 0) goto L_0x0038;
    L_0x0008:
        r0 = r4.b;
        r1 = r0.o0();
        r2 = 7;
        if (r1 == r2) goto L_0x0017;
    L_0x0011:
        r2 = r0.G;
        r3 = c.j.a.d.b.b.h.DELAY_RETRY_WAITING;
        if (r2 != r3) goto L_0x001b;
    L_0x0017:
        r2 = c.j.a.d.b.b.h.DELAY_RETRY_DOWNLOADING;
        r0.G = r2;
    L_0x001b:
        r2 = 8;
        if (r1 == r2) goto L_0x0029;
    L_0x001f:
        r1 = r0.I;
        r2 = c.j.a.d.b.b.a.ASYNC_HANDLE_WAITING;
        if (r1 == r2) goto L_0x0029;
    L_0x0025:
        r2 = c.j.a.d.b.b.a.ASYNC_HANDLE_RESTART;
        if (r1 != r2) goto L_0x002d;
    L_0x0029:
        r1 = c.j.a.d.b.b.a.ASYNC_HANDLE_DOWNLOADING;
        r0.I = r1;
    L_0x002d:
        r1 = r0.k0;
        r2 = c.j.a.d.b.b.b.BYTE_INVALID_RETRY_STATUS_RESTART;
        if (r1 != r2) goto L_0x0037;
    L_0x0033:
        r1 = c.j.a.d.b.b.b.BYTE_INVALID_RETRY_STATUS_DOWNLOADING;
        r0.k0 = r1;
    L_0x0037:
        return;
    L_0x0038:
        r0 = r4.c;
        r1 = r4.b;
        r1 = r1.g0();
        r0.e(r1);
        r0 = r4.b;
        r1 = r0.V;
        r2 = 0;
        r3 = 1;
        if (r1 != 0) goto L_0x004c;
    L_0x004b:
        goto L_0x0074;
    L_0x004c:
        r1 = r0.k0();
        r1 = android.text.TextUtils.isEmpty(r1);
        if (r1 != 0) goto L_0x0074;
    L_0x0056:
        r1 = r0.l0();
        r1 = android.text.TextUtils.isEmpty(r1);
        if (r1 == 0) goto L_0x0061;
    L_0x0060:
        goto L_0x0074;
    L_0x0061:
        r1 = new java.io.File;
        r2 = r0.k0();
        r0 = r0.l0();
        r1.<init>(r2, r0);
        r0 = r1.exists();
        r2 = r0 ^ 1;
    L_0x0074:
        r0 = 0;
        if (r2 == 0) goto L_0x007b;
    L_0x0077:
        r1 = 6;
        r4.b(r1, r0, r3);
    L_0x007b:
        r1 = 2;
        r4.b(r1, r0, r3);
        return;
        */
        throw new UnsupportedOperationException("Method not decompiled: c.j.a.d.b.e.h.g():void");
    }

    public void i() {
        this.b.b0(-2);
        try {
            this.c.C(this.b.g0(), this.b.I());
        } catch (SQLiteException e) {
            e.printStackTrace();
        }
        b(-2, null, true);
    }

    public void j() {
        this.b.b0(-7);
        try {
            this.c.o(this.b.g0());
        } catch (SQLiteException e) {
            e.printStackTrace();
        }
        b(-7, null, true);
    }

    /* JADX WARNING: Removed duplicated region for block: B:57:0x023f A:{SYNTHETIC, Splitter:B:57:0x023f} */
    /* JADX WARNING: Removed duplicated region for block: B:57:0x023f A:{SYNTHETIC, Splitter:B:57:0x023f} */
    public void k() {
        /*
        r17 = this;
        r1 = r17;
        r0 = r1.b;
        r2 = 0;
        r0.V = r2;
        java.util.Objects.requireNonNull(r0);
        r0 = r1.b;
        r3 = r0.I();
        r0 = r1.b;
        r5 = r0.T;
        r7 = (r3 > r5 ? 1 : (r3 == r5 ? 0 : -1));
        if (r7 == 0) goto L_0x003d;
    L_0x0018:
        r2 = q;
        r0 = r0.c0();
        c.j.a.d.b.g.a.d(r2, r0);
        r0 = new com.ss.android.socialbase.downloader.e.g;
        r2 = 1027; // 0x403 float:1.439E-42 double:5.074E-321;
        r3 = "current bytes is not equals to total bytes, bytes changed with process : ";
        r3 = c.b.a.a.a.g(r3);
        r4 = r1.b;
        r4 = r4.k0;
        r3.append(r4);
        r3 = r3.toString();
        r0.m7698init(r2, r3);
        r1.d(r0);
        return;
    L_0x003d:
        r3 = r0.I();
        r5 = 0;
        r0 = (r3 > r5 ? 1 : (r3 == r5 ? 0 : -1));
        if (r0 > 0) goto L_0x006e;
    L_0x0047:
        r0 = q;
        r2 = r1.b;
        r2 = r2.c0();
        c.j.a.d.b.g.a.d(r0, r2);
        r0 = new com.ss.android.socialbase.downloader.e.g;
        r2 = 1026; // 0x402 float:1.438E-42 double:5.07E-321;
        r3 = "curBytes is 0, bytes changed with process : ";
        r3 = c.b.a.a.a.g(r3);
        r4 = r1.b;
        r4 = r4.k0;
        r3.append(r4);
        r3 = r3.toString();
        r0.m7698init(r2, r3);
        r1.d(r0);
        return;
    L_0x006e:
        r0 = r1.b;
        java.util.Objects.requireNonNull(r0);
        r0 = r1.b;
        r3 = r0.T;
        r7 = (r3 > r5 ? 1 : (r3 == r5 ? 0 : -1));
        if (r7 > 0) goto L_0x00a0;
    L_0x007b:
        r2 = q;
        r0 = r0.c0();
        c.j.a.d.b.g.a.d(r2, r0);
        r0 = new com.ss.android.socialbase.downloader.e.g;
        r2 = 1044; // 0x414 float:1.463E-42 double:5.16E-321;
        r3 = "TotalBytes is 0, bytes changed with process : ";
        r3 = c.b.a.a.a.g(r3);
        r4 = r1.b;
        r4 = r4.k0;
        r3.append(r4);
        r3 = r3.toString();
        r0.m7698init(r2, r3);
        r1.d(r0);
        return;
    L_0x00a0:
        r0 = q;
        r3 = "";
        r3 = c.b.a.a.a.g(r3);
        r4 = r1.b;
        r4 = r4.b;
        r3.append(r4);
        r4 = " onCompleted start save file as target name";
        r3.append(r4);
        r3 = r3.toString();
        c.j.a.d.b.g.a.d(r0, r3);
        r0 = r1.p;
        r3 = r1.e;
        if (r3 == 0) goto L_0x00c3;
    L_0x00c1:
        r0 = r3.l;
    L_0x00c3:
        r3 = r1.b;
        r4 = r3.v0;
        r5 = 4;
        r6 = 3;
        r7 = 5;
        r8 = 2;
        r9 = 0;
        r10 = 1;
        if (r4 == 0) goto L_0x0309;
    L_0x00cf:
        r4 = new c.j.a.d.b.e.h$a;
        r4.m6430init();
        r11 = c.j.a.d.b.n.a.a;
        r12 = "saveFileAsTargetName targetName is ";
        r12 = c.b.a.a.a.g(r12);
        r13 = r3.m0();
        r12.append(r13);
        r12 = r12.toString();
        c.j.a.d.b.g.a.d(r11, r12);
        r12 = c.j.a.d.b.n.a.c;	 Catch:{ all -> 0x02e0 }
        monitor-enter(r12);	 Catch:{ all -> 0x02e0 }
        r13 = c.j.a.d.b.n.a.c;	 Catch:{ all -> 0x02dd }
        r14 = r3.g0();	 Catch:{ all -> 0x02dd }
        r13 = r13.get(r14);	 Catch:{ all -> 0x02dd }
        r14 = java.lang.Boolean.TRUE;	 Catch:{ all -> 0x02dd }
        if (r13 != r14) goto L_0x00fd;
    L_0x00fb:
        r13 = 1;
        goto L_0x00fe;
    L_0x00fd:
        r13 = 0;
    L_0x00fe:
        if (r13 == 0) goto L_0x0127;
    L_0x0100:
        r0 = "has another same task is saving temp file";
        c.j.a.d.b.g.a.d(r11, r0);	 Catch:{ all -> 0x02dd }
        r0 = c.j.a.d.b.n.a.d;	 Catch:{ all -> 0x02dd }
        r2 = r3.g0();	 Catch:{ all -> 0x02dd }
        r0 = r0.get(r2);	 Catch:{ all -> 0x02dd }
        r0 = (java.util.List) r0;	 Catch:{ all -> 0x02dd }
        if (r0 != 0) goto L_0x0121;
    L_0x0113:
        r0 = new java.util.ArrayList;	 Catch:{ all -> 0x02dd }
        r0.<init>();	 Catch:{ all -> 0x02dd }
        r2 = c.j.a.d.b.n.a.d;	 Catch:{ all -> 0x02dd }
        r3 = r3.g0();	 Catch:{ all -> 0x02dd }
        r2.put(r3, r0);	 Catch:{ all -> 0x02dd }
    L_0x0121:
        r0.add(r4);	 Catch:{ all -> 0x02dd }
        monitor-exit(r12);	 Catch:{ all -> 0x02dd }
        goto L_0x04cc;
    L_0x0127:
        r13 = new java.lang.StringBuilder;	 Catch:{ all -> 0x02dd }
        r13.<init>();	 Catch:{ all -> 0x02dd }
        r15 = "saveTempFileStatusMap put id:";
        r13.append(r15);	 Catch:{ all -> 0x02dd }
        r15 = r3.g0();	 Catch:{ all -> 0x02dd }
        r13.append(r15);	 Catch:{ all -> 0x02dd }
        r13 = r13.toString();	 Catch:{ all -> 0x02dd }
        c.j.a.d.b.g.a.d(r11, r13);	 Catch:{ all -> 0x02dd }
        r13 = c.j.a.d.b.n.a.c;	 Catch:{ all -> 0x02dd }
        r15 = r3.g0();	 Catch:{ all -> 0x02dd }
        r13.put(r15, r14);	 Catch:{ all -> 0x02dd }
        monitor-exit(r12);	 Catch:{ all -> 0x02dd }
        r12 = new java.io.File;	 Catch:{ all -> 0x02e0 }
        r13 = r3.k0();	 Catch:{ all -> 0x02e0 }
        r14 = r3.l0();	 Catch:{ all -> 0x02e0 }
        r12.<init>(r13, r14);	 Catch:{ all -> 0x02e0 }
        r13 = new java.io.File;	 Catch:{ all -> 0x02e0 }
        r14 = r3.e;	 Catch:{ all -> 0x02e0 }
        r15 = r3.b;	 Catch:{ all -> 0x02e0 }
        r13.<init>(r14, r15);	 Catch:{ all -> 0x02e0 }
        r14 = r13.exists();	 Catch:{ all -> 0x02e0 }
        r15 = 1005; // 0x3ed float:1.408E-42 double:4.965E-321;
        if (r14 == 0) goto L_0x0208;
    L_0x0167:
        r14 = "targetFile exist";
        c.j.a.d.b.g.a.d(r11, r14);	 Catch:{ all -> 0x02e0 }
        r14 = r3.y;	 Catch:{ all -> 0x02e0 }
        r14 = c.j.a.e.b.b(r14, r13);	 Catch:{ all -> 0x02e0 }
        r16 = c.j.a.d.b.n.a.s(r14);	 Catch:{ all -> 0x02e0 }
        if (r16 == 0) goto L_0x018c;
    L_0x0178:
        r0 = "tempFile not exist , targetFile exists and md5 check valid";
        c.j.a.d.b.g.a.d(r11, r0);	 Catch:{ all -> 0x02e0 }
        r3.l(r14);	 Catch:{ all -> 0x02e0 }
        r4.a();	 Catch:{ all -> 0x02e0 }
        r0 = r3.g0();	 Catch:{ all -> 0x02e0 }
        c.j.a.d.b.n.a.k(r0, r10, r9);	 Catch:{ all -> 0x02e0 }
        goto L_0x023a;
    L_0x018c:
        r9 = r12.exists();	 Catch:{ all -> 0x02e0 }
        if (r9 != 0) goto L_0x01c5;
    L_0x0192:
        r9 = new com.ss.android.socialbase.downloader.e.a;	 Catch:{ all -> 0x02e0 }
        r11 = "Can't save the temp downloaded file(%s/%s) to the target file(%s/%s) because tempFile is not exist and target file is exist but md5 verify invalid :%s";
        r7 = new java.lang.Object[r7];	 Catch:{ all -> 0x02e0 }
        r16 = r3.k0();	 Catch:{ all -> 0x02e0 }
        r7[r2] = r16;	 Catch:{ all -> 0x02e0 }
        r16 = r3.l0();	 Catch:{ all -> 0x02e0 }
        r7[r10] = r16;	 Catch:{ all -> 0x02e0 }
        r10 = r3.e;	 Catch:{ all -> 0x02e0 }
        r7[r8] = r10;	 Catch:{ all -> 0x02e0 }
        r10 = r3.b;	 Catch:{ all -> 0x02e0 }
        r7[r6] = r10;	 Catch:{ all -> 0x02e0 }
        r10 = c.j.a.d.b.n.a.z(r14);	 Catch:{ all -> 0x02e0 }
        r7[r5] = r10;	 Catch:{ all -> 0x02e0 }
        r7 = java.lang.String.format(r11, r7);	 Catch:{ all -> 0x02e0 }
        r9.m4677init(r15, r7);	 Catch:{ all -> 0x02e0 }
        r4.a(r9);	 Catch:{ all -> 0x02e0 }
        r7 = r3.g0();	 Catch:{ all -> 0x02e0 }
        c.j.a.d.b.n.a.k(r7, r2, r9);	 Catch:{ all -> 0x02e0 }
        r7 = 0;
        goto L_0x01c6;
    L_0x01c5:
        r7 = 1;
    L_0x01c6:
        r9 = r13.delete();	 Catch:{ all -> 0x02e0 }
        if (r9 != 0) goto L_0x023d;
    L_0x01cc:
        if (r7 != 0) goto L_0x01e1;
    L_0x01ce:
        if (r0 == 0) goto L_0x023d;
    L_0x01d0:
        r9 = new com.ss.android.socialbase.downloader.e.a;	 Catch:{ all -> 0x02e0 }
        r10 = "tempFile is not exist and target file is exist but md5 verify invalid, delete target file failed";
        r11 = 1038; // 0x40e float:1.455E-42 double:5.13E-321;
        r9.m4677init(r11, r10);	 Catch:{ all -> 0x02e0 }
        r10 = r3.o0();	 Catch:{ all -> 0x02e0 }
        c.j.a.c.y.a.i.n(r0, r3, r9, r10);	 Catch:{ all -> 0x02e0 }
        goto L_0x023d;
    L_0x01e1:
        r0 = new com.ss.android.socialbase.downloader.e.a;	 Catch:{ all -> 0x02e0 }
        r7 = new java.lang.StringBuilder;	 Catch:{ all -> 0x02e0 }
        r7.<init>();	 Catch:{ all -> 0x02e0 }
        r9 = "delete targetPath file existed with md5 check invalid status:";
        r7.append(r9);	 Catch:{ all -> 0x02e0 }
        r9 = c.j.a.d.b.n.a.z(r14);	 Catch:{ all -> 0x02e0 }
        r7.append(r9);	 Catch:{ all -> 0x02e0 }
        r7 = r7.toString();	 Catch:{ all -> 0x02e0 }
        r9 = 1037; // 0x40d float:1.453E-42 double:5.123E-321;
        r0.m4677init(r9, r7);	 Catch:{ all -> 0x02e0 }
        r4.a(r0);	 Catch:{ all -> 0x02e0 }
        r7 = r3.g0();	 Catch:{ all -> 0x02e0 }
        c.j.a.d.b.n.a.k(r7, r2, r0);	 Catch:{ all -> 0x02e0 }
        goto L_0x023a;
    L_0x0208:
        r0 = r12.exists();	 Catch:{ all -> 0x02e0 }
        if (r0 != 0) goto L_0x023c;
    L_0x020e:
        r0 = new com.ss.android.socialbase.downloader.e.a;	 Catch:{ all -> 0x02e0 }
        r7 = "Can't save the temp downloaded file(%s/%s) to the target file(%s/%s) because tempFile is not exist";
        r9 = new java.lang.Object[r5];	 Catch:{ all -> 0x02e0 }
        r10 = r3.k0();	 Catch:{ all -> 0x02e0 }
        r9[r2] = r10;	 Catch:{ all -> 0x02e0 }
        r10 = r3.l0();	 Catch:{ all -> 0x02e0 }
        r11 = 1;
        r9[r11] = r10;	 Catch:{ all -> 0x02e0 }
        r10 = r3.e;	 Catch:{ all -> 0x02e0 }
        r9[r8] = r10;	 Catch:{ all -> 0x02e0 }
        r10 = r3.b;	 Catch:{ all -> 0x02e0 }
        r9[r6] = r10;	 Catch:{ all -> 0x02e0 }
        r7 = java.lang.String.format(r7, r9);	 Catch:{ all -> 0x02e0 }
        r0.m4677init(r15, r7);	 Catch:{ all -> 0x02e0 }
        r4.a(r0);	 Catch:{ all -> 0x02e0 }
        r7 = r3.g0();	 Catch:{ all -> 0x02e0 }
        c.j.a.d.b.n.a.k(r7, r2, r0);	 Catch:{ all -> 0x02e0 }
    L_0x023a:
        r7 = 0;
        goto L_0x023d;
    L_0x023c:
        r7 = 1;
    L_0x023d:
        if (r7 == 0) goto L_0x04cc;
    L_0x023f:
        r0 = c.j.a.d.b.n.a.I(r12, r13);	 Catch:{ a -> 0x0247 }
        r0 = r0 ^ 1;
        r7 = 0;
        goto L_0x025f;
    L_0x0247:
        r0 = move-exception;
        r7 = r3.g0();	 Catch:{ all -> 0x02e0 }
        r7 = c.j.a.d.b.l.a.d(r7);	 Catch:{ all -> 0x02e0 }
        r9 = "fix_file_rename_failed";
        r7 = r7.k(r9, r2);	 Catch:{ all -> 0x02e0 }
        if (r7 == 0) goto L_0x025c;
    L_0x0258:
        r7 = 1;
        r7 = r0;
        r0 = 1;
        goto L_0x025f;
    L_0x025c:
        r7 = 0;
        r7 = r0;
        r0 = 0;
    L_0x025f:
        if (r0 == 0) goto L_0x0293;
    L_0x0261:
        if (r7 != 0) goto L_0x0287;
    L_0x0263:
        r7 = new com.ss.android.socialbase.downloader.e.a;	 Catch:{ all -> 0x02e0 }
        r0 = "Can't save the temp downloaded file(%s/%s) to the target file(%s/%s)";
        r5 = new java.lang.Object[r5];	 Catch:{ all -> 0x02e0 }
        r9 = r3.k0();	 Catch:{ all -> 0x02e0 }
        r5[r2] = r9;	 Catch:{ all -> 0x02e0 }
        r9 = r3.l0();	 Catch:{ all -> 0x02e0 }
        r10 = 1;
        r5[r10] = r9;	 Catch:{ all -> 0x02e0 }
        r9 = r3.e;	 Catch:{ all -> 0x02e0 }
        r5[r8] = r9;	 Catch:{ all -> 0x02e0 }
        r8 = r3.b;	 Catch:{ all -> 0x02e0 }
        r5[r6] = r8;	 Catch:{ all -> 0x02e0 }
        r0 = java.lang.String.format(r0, r5);	 Catch:{ all -> 0x02e0 }
        r5 = 1038; // 0x40e float:1.455E-42 double:5.13E-321;
        r7.m4677init(r5, r0);	 Catch:{ all -> 0x02e0 }
    L_0x0287:
        r4.a(r7);	 Catch:{ all -> 0x02e0 }
        r0 = r3.g0();	 Catch:{ all -> 0x02e0 }
        c.j.a.d.b.n.a.k(r0, r2, r7);	 Catch:{ all -> 0x02e0 }
        goto L_0x04cc;
    L_0x0293:
        r0 = r3.g0();	 Catch:{ all -> 0x02e0 }
        r0 = c.j.a.d.b.l.a.d(r0);	 Catch:{ all -> 0x02e0 }
        r5 = "download_finish_check_ttmd5";
        r0 = r0.b(r5, r8);	 Catch:{ all -> 0x02e0 }
        if (r0 <= 0) goto L_0x02cf;
    L_0x02a3:
        r5 = r3.y;	 Catch:{ all -> 0x02e0 }
        r5 = c.j.a.e.b.b(r5, r13);	 Catch:{ all -> 0x02e0 }
        r3.l(r5);	 Catch:{ all -> 0x02e0 }
        if (r0 < r8) goto L_0x02cf;
    L_0x02ae:
        r0 = c.j.a.d.b.n.a.s(r5);	 Catch:{ all -> 0x02e0 }
        if (r0 != 0) goto L_0x02cf;
    L_0x02b4:
        r0 = new com.ss.android.socialbase.downloader.e.a;	 Catch:{ all -> 0x02e0 }
        r5 = c.j.a.d.b.n.a.z(r5);	 Catch:{ all -> 0x02e0 }
        r6 = 1034; // 0x40a float:1.449E-42 double:5.11E-321;
        r0.m4677init(r6, r5);	 Catch:{ all -> 0x02e0 }
        r4.a(r0);	 Catch:{ all -> 0x02e0 }
        r5 = r3.g0();	 Catch:{ all -> 0x02e0 }
        c.j.a.d.b.n.a.k(r5, r2, r0);	 Catch:{ all -> 0x02e0 }
        r0 = 1;
        c.j.a.d.b.n.a.n(r3, r0);	 Catch:{ all -> 0x02e0 }
        goto L_0x04cc;
    L_0x02cf:
        r4.a();	 Catch:{ all -> 0x02e0 }
        r0 = r3.g0();	 Catch:{ all -> 0x02e0 }
        r2 = 0;
        r3 = 1;
        c.j.a.d.b.n.a.k(r0, r3, r2);	 Catch:{ all -> 0x02e0 }
        goto L_0x04cc;
    L_0x02dd:
        r0 = move-exception;
        monitor-exit(r12);	 Catch:{ all -> 0x02dd }
        throw r0;	 Catch:{ all -> 0x02e0 }
    L_0x02e0:
        r0 = move-exception;
        r2 = c.j.a.d.b.n.a.a;
        r3 = "saveFileAsTargetName throwable ";
        r3 = c.b.a.a.a.g(r3);
        r5 = r0.getMessage();
        r3.append(r5);
        r3 = r3.toString();
        c.j.a.d.b.g.a.d(r2, r3);
        r2 = new com.ss.android.socialbase.downloader.e.a;
        r3 = "saveFileAsTargetName";
        r0 = c.j.a.d.b.n.a.B(r0, r3);
        r3 = 1038; // 0x40e float:1.455E-42 double:5.13E-321;
        r2.m4677init(r3, r0);
        r4.a(r2);
        goto L_0x04cc;
    L_0x0309:
        r4 = new c.j.a.d.b.e.h$b;
        r4.m6431init();
        r0 = c.j.a.d.b.n.a.a;
        r9 = "saveFileAsTargetName targetName is ";
        r9 = c.b.a.a.a.g(r9);
        r10 = r3.m0();
        r9.append(r10);
        r9 = r9.toString();
        c.j.a.d.b.g.a.d(r0, r9);
        r9 = new java.io.File;	 Catch:{ all -> 0x04a5 }
        r10 = r3.k0();	 Catch:{ all -> 0x04a5 }
        r11 = r3.l0();	 Catch:{ all -> 0x04a5 }
        r9.<init>(r10, r11);	 Catch:{ all -> 0x04a5 }
        r10 = new java.io.File;	 Catch:{ all -> 0x04a5 }
        r11 = r3.e;	 Catch:{ all -> 0x04a5 }
        r12 = r3.b;	 Catch:{ all -> 0x04a5 }
        r10.<init>(r11, r12);	 Catch:{ all -> 0x04a5 }
        r11 = c.j.a.d.b.e.b.a();	 Catch:{ all -> 0x04a5 }
        r11 = c.j.a.d.b.e.i.a(r11);	 Catch:{ all -> 0x04a5 }
        r12 = r3.g0();	 Catch:{ all -> 0x04a5 }
        r11 = r11.k(r12);	 Catch:{ all -> 0x04a5 }
        r12 = r9.exists();	 Catch:{ all -> 0x04a5 }
        if (r12 != 0) goto L_0x0395;
    L_0x0350:
        r12 = "tempFile not exist";
        c.j.a.d.b.g.a.d(r0, r12);	 Catch:{ all -> 0x04a5 }
        r12 = r10.exists();	 Catch:{ all -> 0x04a5 }
        if (r12 == 0) goto L_0x0383;
    L_0x035b:
        r12 = "targetFile exist";
        c.j.a.d.b.g.a.d(r0, r12);	 Catch:{ all -> 0x04a5 }
        r12 = r3.y;	 Catch:{ all -> 0x04a5 }
        r12 = c.j.a.e.b.b(r12, r10);	 Catch:{ all -> 0x04a5 }
        r12 = c.j.a.d.b.n.a.s(r12);	 Catch:{ all -> 0x04a5 }
        if (r12 == 0) goto L_0x0376;
    L_0x036c:
        r2 = "tempFile not exist , targetFile exists and md5 check valid";
        c.j.a.d.b.g.a.d(r0, r2);	 Catch:{ all -> 0x04a5 }
        r4.a();	 Catch:{ all -> 0x04a5 }
        goto L_0x04cc;
    L_0x0376:
        if (r11 == 0) goto L_0x0413;
    L_0x0378:
        r0 = r11.T();	 Catch:{ all -> 0x04a5 }
        if (r0 == 0) goto L_0x0413;
    L_0x037e:
        r11.r(r4);	 Catch:{ all -> 0x04a5 }
        goto L_0x04cc;
    L_0x0383:
        r12 = "targetFile not exist";
        c.j.a.d.b.g.a.d(r0, r12);	 Catch:{ all -> 0x04a5 }
        if (r11 == 0) goto L_0x0413;
    L_0x038a:
        r0 = r11.T();	 Catch:{ all -> 0x04a5 }
        if (r0 == 0) goto L_0x0413;
    L_0x0390:
        r11.r(r4);	 Catch:{ all -> 0x04a5 }
        goto L_0x04cc;
    L_0x0395:
        r12 = r10.exists();	 Catch:{ all -> 0x04a5 }
        if (r12 == 0) goto L_0x0413;
    L_0x039b:
        r12 = "targetFile exist";
        c.j.a.d.b.g.a.d(r0, r12);	 Catch:{ all -> 0x04a5 }
        r12 = r3.y;	 Catch:{ all -> 0x04a5 }
        r12 = c.j.a.e.b.b(r12, r10);	 Catch:{ all -> 0x04a5 }
        r13 = c.j.a.d.b.n.a.s(r12);	 Catch:{ all -> 0x04a5 }
        if (r13 == 0) goto L_0x03b6;
    L_0x03ac:
        r2 = "tempFile exist , targetFile exists and md5 check valid";
        c.j.a.d.b.g.a.d(r0, r2);	 Catch:{ all -> 0x04a5 }
        r4.a();	 Catch:{ all -> 0x04a5 }
        goto L_0x04cc;
    L_0x03b6:
        if (r11 == 0) goto L_0x03c3;
    L_0x03b8:
        r13 = r11.T();	 Catch:{ all -> 0x04a5 }
        if (r13 == 0) goto L_0x03c3;
    L_0x03be:
        r11.r(r4);	 Catch:{ all -> 0x04a5 }
        goto L_0x04cc;
    L_0x03c3:
        if (r11 == 0) goto L_0x03cf;
    L_0x03c5:
        monitor-enter(r11);	 Catch:{ all -> 0x04a5 }
        r13 = 1;
        r11.q0 = r13;	 Catch:{ all -> 0x03cb }
        monitor-exit(r11);	 Catch:{ all -> 0x04a5 }
        goto L_0x03cf;
    L_0x03cb:
        r0 = move-exception;
        r2 = r0;
        monitor-exit(r11);	 Catch:{ all -> 0x04a5 }
        throw r2;	 Catch:{ all -> 0x04a5 }
    L_0x03cf:
        r13 = new java.lang.StringBuilder;	 Catch:{ all -> 0x04a5 }
        r13.<init>();	 Catch:{ all -> 0x04a5 }
        r14 = "saveFileAsTargetName: ";
        r13.append(r14);	 Catch:{ all -> 0x04a5 }
        r14 = r10.getPath();	 Catch:{ all -> 0x04a5 }
        r13.append(r14);	 Catch:{ all -> 0x04a5 }
        r13 = r13.toString();	 Catch:{ all -> 0x04a5 }
        android.util.Log.e(r0, r13);	 Catch:{ all -> 0x04a5 }
        r0 = r10.delete();	 Catch:{ all -> 0x04a5 }
        if (r0 != 0) goto L_0x0413;
    L_0x03ed:
        r0 = new com.ss.android.socialbase.downloader.e.a;	 Catch:{ all -> 0x04a5 }
        r3 = new java.lang.StringBuilder;	 Catch:{ all -> 0x04a5 }
        r3.<init>();	 Catch:{ all -> 0x04a5 }
        r5 = "delete targetPath file existed with md5 check invalid status:";
        r3.append(r5);	 Catch:{ all -> 0x04a5 }
        r5 = c.j.a.d.b.n.a.z(r12);	 Catch:{ all -> 0x04a5 }
        r3.append(r5);	 Catch:{ all -> 0x04a5 }
        r3 = r3.toString();	 Catch:{ all -> 0x04a5 }
        r5 = 1037; // 0x40d float:1.453E-42 double:5.123E-321;
        r0.m4677init(r5, r3);	 Catch:{ all -> 0x04a5 }
        r4.a(r0);	 Catch:{ all -> 0x04a5 }
        if (r11 == 0) goto L_0x04cc;
    L_0x040e:
        r11.u(r2, r0);	 Catch:{ all -> 0x04a5 }
        goto L_0x04cc;
    L_0x0413:
        if (r11 == 0) goto L_0x041f;
    L_0x0415:
        monitor-enter(r11);	 Catch:{ all -> 0x04a5 }
        r0 = 1;
        r11.q0 = r0;	 Catch:{ all -> 0x041b }
        monitor-exit(r11);	 Catch:{ all -> 0x04a5 }
        goto L_0x041f;
    L_0x041b:
        r0 = move-exception;
        r2 = r0;
        monitor-exit(r11);	 Catch:{ all -> 0x04a5 }
        throw r2;	 Catch:{ all -> 0x04a5 }
    L_0x041f:
        r0 = c.j.a.d.b.n.a.I(r9, r10);	 Catch:{ a -> 0x0427 }
        r0 = r0 ^ 1;
        r12 = 0;
        goto L_0x042b;
    L_0x0427:
        r0 = move-exception;
        r12 = 0;
        r12 = r0;
        r0 = 0;
    L_0x042b:
        if (r0 == 0) goto L_0x0466;
    L_0x042d:
        if (r12 != 0) goto L_0x045d;
    L_0x042f:
        r0 = r9.exists();	 Catch:{ all -> 0x04a5 }
        r12 = new com.ss.android.socialbase.downloader.e.a;	 Catch:{ all -> 0x04a5 }
        r9 = "Can't save the temp downloaded file(%s/%s) to the target file(%s/%s), temp file is exist: %d";
        r7 = new java.lang.Object[r7];	 Catch:{ all -> 0x04a5 }
        r10 = r3.k0();	 Catch:{ all -> 0x04a5 }
        r7[r2] = r10;	 Catch:{ all -> 0x04a5 }
        r10 = r3.l0();	 Catch:{ all -> 0x04a5 }
        r13 = 1;
        r7[r13] = r10;	 Catch:{ all -> 0x04a5 }
        r10 = r3.e;	 Catch:{ all -> 0x04a5 }
        r7[r8] = r10;	 Catch:{ all -> 0x04a5 }
        r3 = r3.b;	 Catch:{ all -> 0x04a5 }
        r7[r6] = r3;	 Catch:{ all -> 0x04a5 }
        r0 = java.lang.Boolean.valueOf(r0);	 Catch:{ all -> 0x04a5 }
        r7[r5] = r0;	 Catch:{ all -> 0x04a5 }
        r0 = java.lang.String.format(r9, r7);	 Catch:{ all -> 0x04a5 }
        r3 = 1038; // 0x40e float:1.455E-42 double:5.13E-321;
        r12.m4677init(r3, r0);	 Catch:{ all -> 0x04a5 }
    L_0x045d:
        r4.a(r12);	 Catch:{ all -> 0x04a5 }
        if (r11 == 0) goto L_0x04cc;
    L_0x0462:
        r11.u(r2, r12);	 Catch:{ all -> 0x04a5 }
        goto L_0x04cc;
    L_0x0466:
        r0 = r3.g0();	 Catch:{ all -> 0x04a5 }
        r0 = c.j.a.d.b.l.a.d(r0);	 Catch:{ all -> 0x04a5 }
        r2 = "download_finish_check_ttmd5";
        r0 = r0.b(r2, r8);	 Catch:{ all -> 0x04a5 }
        if (r0 <= 0) goto L_0x049a;
    L_0x0476:
        r2 = r3.y;	 Catch:{ all -> 0x04a5 }
        r2 = c.j.a.e.b.b(r2, r10);	 Catch:{ all -> 0x04a5 }
        r3.l(r2);	 Catch:{ all -> 0x04a5 }
        if (r0 < r8) goto L_0x049a;
    L_0x0481:
        r0 = c.j.a.d.b.n.a.s(r2);	 Catch:{ all -> 0x04a5 }
        if (r0 != 0) goto L_0x049a;
    L_0x0487:
        r0 = new com.ss.android.socialbase.downloader.e.a;	 Catch:{ all -> 0x04a5 }
        r2 = c.j.a.d.b.n.a.z(r2);	 Catch:{ all -> 0x04a5 }
        r5 = 1034; // 0x40a float:1.449E-42 double:5.11E-321;
        r0.m4677init(r5, r2);	 Catch:{ all -> 0x04a5 }
        r4.a(r0);	 Catch:{ all -> 0x04a5 }
        r0 = 1;
        c.j.a.d.b.n.a.n(r3, r0);	 Catch:{ all -> 0x04a5 }
        goto L_0x04cc;
    L_0x049a:
        r4.a();	 Catch:{ all -> 0x04a5 }
        if (r11 == 0) goto L_0x04cc;
    L_0x049f:
        r0 = 0;
        r2 = 1;
        r11.u(r2, r0);	 Catch:{ all -> 0x04a5 }
        goto L_0x04cc;
    L_0x04a5:
        r0 = move-exception;
        r2 = c.j.a.d.b.n.a.a;
        r3 = "saveFileAsTargetName throwable ";
        r3 = c.b.a.a.a.g(r3);
        r5 = r0.getMessage();
        r3.append(r5);
        r3 = r3.toString();
        c.j.a.d.b.g.a.d(r2, r3);
        r2 = new com.ss.android.socialbase.downloader.e.a;
        r3 = "saveFileAsTargetName";
        r0 = c.j.a.d.b.n.a.B(r0, r3);
        r3 = 1038; // 0x40e float:1.455E-42 double:5.13E-321;
        r2.m4677init(r3, r0);
        r4.a(r2);
    L_0x04cc:
        return;
        */
        throw new UnsupportedOperationException("Method not decompiled: c.j.a.d.b.e.h.k():void");
    }

    public void l() throws com.ss.android.socialbase.downloader.e.a {
        String str = "onCompleteForFileExist";
        if (this.a) {
            o();
            c.j.a.d.b.g.a.d(q, str);
            b(-3, null, true);
            this.c.t(this.b.g0(), this.b.T);
            this.c.d(this.b.g0());
            this.c.a(this.b);
            return;
        }
        o();
        c.j.a.d.b.g.a.d(q, str);
        b(-3, null, true);
        this.c.t(this.b.g0(), this.b.T);
        this.c.d(this.b.g0());
    }

    public void m() {
        this.b.b0(8);
        this.b.I = c.j.a.d.b.b.a.ASYNC_HANDLE_WAITING;
        c.j.a.d.b.j.c B = b.B();
        if (B != null) {
            B.b(this.b.g0(), 8);
        }
    }

    public final void n() {
        c.j.a.d.b.h.c cVar = this.e;
        if (cVar != null) {
            this.b = cVar.a;
            this.f = cVar.a(g.MAIN);
            this.h = this.e.a(g.NOTIFICATION);
            this.g = this.e.a(g.SUB);
            cVar = this.e;
            this.o = cVar.k;
            this.p = cVar.l;
        }
    }

    public final void o() throws com.ss.android.socialbase.downloader.e.a {
        c.j.a.d.b.d.a0 a0Var = this.e.t;
        if (a0Var != null) {
            try {
                c cVar = this.b;
                if (a0Var.b(cVar)) {
                    b(11, null, true);
                    this.c.a(cVar);
                    a0Var.a(cVar);
                    this.c.a(cVar);
                }
            } catch (com.ss.android.socialbase.downloader.e.a e) {
                throw e;
            } catch (Throwable th) {
                com.ss.android.socialbase.downloader.e.a aVar = new com.ss.android.socialbase.downloader.e.a(1071, th);
            }
        }
    }
}
